package com.dq.Service.Impl;

import com.dq.Mapper.TeaMapper;
import com.dq.Pojo.Teacher;
import com.dq.Service.TeaService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeaServiceImpl implements TeaService {
    @Autowired
    private  TeaMapper teaMapper;
    @Override
    public void addtea(Teacher teacher) {
        teaMapper.addtea(teacher);
    }

    @Override
    public Teacher findtea(Integer id) {
        return teaMapper.findtea(id);
    }

    @Override
    public void update(Teacher teacher) {
        teaMapper.update(teacher);
    }

    @Override
    public PageInfo<Teacher> findAll(Integer pageNum, Integer pageSize, String name, String teano) {
        PageHelper.startPage(pageNum,pageSize);
        List<Teacher> teacherList=teaMapper.findAll(name,teano);

        PageInfo<Teacher> pageInfo=new PageInfo<>(teacherList);
        return pageInfo;
    }

    @Override
    public void delete(Integer id) {
        teaMapper.delete(id);
    }

    @Override
    public List<Teacher> find() {
        return teaMapper.find();
    }
}
